<html>
<head><meta charset="utf-8"><title>Remove `mark_attr_used` and move logic to `CheckAttrVisitor` · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html">Remove `mark_attr_used` and move logic to `CheckAttrVisitor`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="247536349"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247536349" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247536349">(Jul 29 2021 at 01:37)</a>:</h4>
<p><code>Session.used_attrs</code> is one of the main remaining sources of untracked global state in the compiler. However, we only ever update it for several hardcoded builtin attributes (e..g deprecation, stability, and a few others) in a few parts of the compiler.</p>
<p>I think it would be feasible to remove it entirely, and just lint when those attributes are used in the wrong place. We already have logic to do this in <code>CheckAttrVisitor</code> - we would just emit a lint instead of a hard error</p>



<a name="247536397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247536397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247536397">(Jul 29 2021 at 01:38)</a>:</h4>
<p>This didn't seem big enough to warrant an MCP, but I wanted to get some feedback, in case anyone is planning to add new <code>mark_attr_used</code> calls</p>



<a name="247536417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247536417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247536417">(Jul 29 2021 at 01:39)</a>:</h4>
<p>I think that whever an attribute is 'used' (for the purpose of linting) can be determined entirely by its position in the HIR</p>



<a name="247536473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247536473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247536473">(Jul 29 2021 at 01:40)</a>:</h4>
<p>so 'dynamically' marking an attr used is not necessary</p>



<a name="247546767"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247546767" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247546767">(Jul 29 2021 at 05:48)</a>:</h4>
<p>That doesn't work for tool lints. Those are unknown to rustc before they are registered using <code>#![register_tool]</code> or <code>#![register_attribute]</code>.</p>



<a name="247587992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247587992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247587992">(Jul 29 2021 at 14:09)</a>:</h4>
<p><span class="user-mention" data-user-id="133247">@bjorn3</span> Can you give me an example? <code>CheckAttrVisitor</code> is run after we've constructed a <code>TyCtxt</code>, so we should have registered all tool lints by that point</p>



<a name="247591731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247591731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247591731">(Jul 29 2021 at 14:34)</a>:</h4>
<p>I mean that every tool may have its own rules unknown to rustc around what attributes are used where.</p>



<a name="247592010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592010">(Jul 29 2021 at 14:36)</a>:</h4>
<p>Tools aren't really integrated with the query system, right (they can't define new queries)? I think it would be straightforward for a tool to re-implmenet the current logic themselves if they really want it</p>



<a name="247592064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592064">(Jul 29 2021 at 14:37)</a>:</h4>
<p>Tools can (and do) overwrite existing queries.</p>



<a name="247592126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592126">(Jul 29 2021 at 14:37)</a>:</h4>
<p>hmm - do you know of any tools using <code>mark_attr_used</code>?</p>



<a name="247592239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592239">(Jul 29 2021 at 14:38)</a>:</h4>
<p>I would really like to get rid of this untracked global state</p>



<a name="247592261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592261">(Jul 29 2021 at 14:38)</a>:</h4>
<p>and have tools move to something like <code>CheckAttrVisitor</code></p>



<a name="247592387"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592387" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592387">(Jul 29 2021 at 14:39)</a>:</h4>
<p>It looks like <a href="https://github.com/facebookexperimental/MIRAI">https://github.com/facebookexperimental/MIRAI</a> doesn't use it</p>



<a name="247592584"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592584" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592584">(Jul 29 2021 at 14:40)</a>:</h4>
<p>nor does <a href="https://github.com/model-checking/rmc">https://github.com/model-checking/rmc</a></p>



<a name="247592761"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592761" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592761">(Jul 29 2021 at 14:41)</a>:</h4>
<p>is this even something that tools need at all?</p>



<a name="247592860"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592860" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592860">(Jul 29 2021 at 14:42)</a>:</h4>
<p>by default tool attributes are not causing unused attribute lints</p>



<a name="247592862"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592862" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592862">(Jul 29 2021 at 14:42)</a>:</h4>
<p>If a tool wanted to re-use our existing infrastructure for marking attributes as used</p>



<a name="247592930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247592930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247592930">(Jul 29 2021 at 14:42)</a>:</h4>
<p>not sure what/whether the tool attribute RFC said something about that</p>



<a name="247593032"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247593032" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247593032">(Jul 29 2021 at 14:43)</a>:</h4>
<p>but I don't think any tools are doing that now, so seems fine to change it and require using a different scheme</p>



<a name="247593084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247593084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247593084">(Jul 29 2021 at 14:43)</a>:</h4>
<p>The rustfmt and clippy tool namespaces are hard coded in rustc. Rust-gpu uses <code>#![register_attr(spirv)]</code>. This attribute can only be used on functions I think. It needed to overwrite the <code>check_mod_attrs</code> query though as unused attribute errors are reported before codegen happens (which would use them).</p>
<p><a href="https://github.com/EmbarkStudios/rust-gpu/blob/b9867d0e84d29d6e60ad62427f453b4829abda56/examples/shaders/compute-shader/src/lib.rs#L41">https://github.com/EmbarkStudios/rust-gpu/blob/b9867d0e84d29d6e60ad62427f453b4829abda56/examples/shaders/compute-shader/src/lib.rs#L41</a></p>



<a name="247593104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247593104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247593104">(Jul 29 2021 at 14:43)</a>:</h4>
<p><a href="https://github.com/EmbarkStudios/rust-gpu/pull/461/files#diff-94a279ab4b4b26c27eb846eab23c59bebf583779e89391953c0fe2bffe179fc3R309">https://github.com/EmbarkStudios/rust-gpu/pull/461/files#diff-94a279ab4b4b26c27eb846eab23c59bebf583779e89391953c0fe2bffe179fc3R309</a></p>



<a name="247593613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247593613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247593613">(Jul 29 2021 at 14:46)</a>:</h4>
<p>We could skip all tool attributes when emitting warnings in our <code>UnusedAttributes</code> pass, and leave it up to the tool to determine how they want to emit the lint</p>



<a name="247593710"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247593710" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247593710">(Jul 29 2021 at 14:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125294">Aaron Hill</span> <a href="#narrow/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60/near/247593613">said</a>:</p>
<blockquote>
<p>We could skip all tool attributes when emitting warnings in our <code>UnusedAttributes</code> pass, and leave it up to the tool to determine how they want to emit the lint</p>
</blockquote>
<p>this is how I thought it was already happening</p>



<a name="247593717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247593717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247593717">(Jul 29 2021 at 14:46)</a>:</h4>
<p>Looking at what rust-gpu does, it seems like a <code>CheckAttrVisitor</code>-like approach would work fine</p>



<a name="247593856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247593856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247593856">(Jul 29 2021 at 14:47)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> It looks like we only skip <code>AssumedUsed</code> builtin attrs: <a href="https://github.com/rust-lang/rust/blob/5fb3394cbdf0622c9d0c292feb55db0f4c828dc3/compiler/rustc_lint/src/unused.rs#L398-L407">https://github.com/rust-lang/rust/blob/5fb3394cbdf0622c9d0c292feb55db0f4c828dc3/compiler/rustc_lint/src/unused.rs#L398-L407</a></p>



<a name="247594368"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247594368" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247594368">(Jul 29 2021 at 14:50)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="119009">@eddyb</span> - <code>rust-gpu</code> is currently using <code>mark_attr_used</code> on the custom <code>#[spirv]</code> attribute. I'm considering removing <code>mark_attr_used</code> (which is a source of untracked global state), and moving the relevant logic to <code>CheckAttrVisitor</code>.  Would this interfere with <code>rust-gpu</code>?</p>



<a name="247595207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247595207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247595207">(Jul 29 2021 at 14:56)</a>:</h4>
<p>We could also refactor <code>CheckAttrVisitor</code> to make it easy for custom tools to re-use some of the logic</p>



<a name="247595257"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247595257" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247595257">(Jul 29 2021 at 14:56)</a>:</h4>
<p>e.g. allow overriding <code>check_attributes</code> in some way</p>



<a name="247614379"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247614379" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247614379">(Jul 29 2021 at 17:24)</a>:</h4>
<p>I don't know if this is related, but I changed <code>unknown_lints</code> a few months ago to also check tool lints (by assuming than if at least one tool attribute is registered, then all attributes are registered for that tool). Not sure if that interacts with mark_attr_used in any way.</p>



<a name="247614507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247614507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247614507">(Jul 29 2021 at 17:25)</a>:</h4>
<p>That doesn't seem to use <code>used_attrs</code> at all</p>



<a name="247773509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Remove%20%60mark_attr_used%60%20and%20move%20logic%20to%20%60CheckAttrVisitor%60/near/247773509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Hill <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Remove.20.60mark_attr_used.60.20and.20move.20logic.20to.20.60CheckAttrVisitor.60.html#247773509">(Jul 30 2021 at 23:36)</a>:</h4>
<p>Actually, it looks like <code>CheckSpirvAttrVisitor</code> is basically a copy of <code>CheckAttrVisitor</code>, so removing <code>mark_attr_used</code> won't interfere with anything</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>